<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../print.css" type="text/css" media="print">
<meta content="SocketURLLoader,code.google.as3httpclient.SocketURLLoader,dataFormat,data,responseHeaders,load,close" name="keywords">
<title>code.google.as3httpclient.SocketURLLoader</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'SocketURLLoader - AS3HTTPClient documentation';
				var baseRef = '../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">AS3HTTPClient documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../index-list.html')" href="../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../index.html?code/google/as3httpclient/SocketURLLoader.html&amp;code/google/as3httpclient/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;SocketURLLoader</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a>&nbsp;| <a href="#eventSummary">Events</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class SocketURLLoader"); titleBar_setSubNav(false,true,false,false,true,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">code.google.as3httpclient</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class SocketURLLoader</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">SocketURLLoader <img class="inheritArrow" alt="Inheritance" title="Inheritance" src="../../../images/inherit-arrow.gif"> flash.events.EventDispatcher</td>
</tr>
</table>
<p></p>
  This class can in most cases be used as a replacement for the URLLoader class. <br />
  <br />
  It allows you to do things that are not possible with the URLLoader class:<br />
  <ul>
    <li>Authenticating without showing an authentication window on each request</li>
    <li>Adding request headers that are forbidden by the URLLoader class</li>
    <li>Uploading files to a server that uses http authentication</li>
    <li>Copying bytes (for example from images downloaded using this loader)</li>
  </ul>
  <br />
  Note that to authenticate you need to include an authentication header. An 
  authentication header looks like this:<br />
  <br />
  "Authorization: Basic" + Base64.encode(username + ":" + password))<br />
  <br />
  If the data from the server does not contain a Content-Length header and the 
  Transfer-Encoding header is not set to chunked, results will be unexpected.
  <p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#data">data</a> : *<div class="summaryTableDescription">[read-only]
   Will contain the data as soon as the complete event has been dispatched
   </div>
</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#dataFormat">dataFormat</a> : String<div class="summaryTableDescription">
   The format of the data that is retrieved from the request.</div>
</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#responseHeaders">responseHeaders</a> : Array<div class="summaryTableDescription">[read-only]
   Will contain the response headers as soon as the complete event has been dispatched.</div>
</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#SocketURLLoader()">SocketURLLoader</a>(request:Object = null)</div>
<div class="summaryTableDescription">
   The reqeust is given to the load method if given.</div>
</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#close()">close</a>(dispatchEvent_bool:Boolean = false):void</div>
<div class="summaryTableDescription">
   If the socket is connected it will be closed.</div>
</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#load()">load</a>(request:Object):void</div>
<div class="summaryTableDescription">
   If the given request is of type URLRequest, the reqeust is converted to an instance of 
   SocketHTTPRequest.<br />
   <br />
   If the socket is still open it will close the socket.<br />
   <br />
   If no port could be extraced from the url, port 80 is used.<br />
   
   </div>
</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
</table>
</div>
<a name="eventSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Events</div>
<table id="summaryTableEvent" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Event</th><th>Summary</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:close">close</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched when the socket is closed.</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:complete">complete</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched when the data has completed loading
  </td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:httpStatus">httpStatus</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched if the header is received from the server
  </td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:ioError">ioError</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched when a socket throws an ioError
  </td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:open">open</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched when the socket is connected.</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:progress">progress</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Note that the progress event gives strange results for chunked data
  If the data received from the server is send chunked it will send progress 
  events for each separate chunk.</td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:securityError">securityError</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched when the socket throws a security error
  </td><td class="summaryTableOwnerCol">SocketURLLoader</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="data"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">data</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>data:*</code>&nbsp;&nbsp;[read-only]<p>
   Will contain the data as soon as the complete event has been dispatched
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get data():*</code>
<br>
</div>
<a name="dataFormat"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">dataFormat</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var dataFormat:String</code><p>
   The format of the data that is retrieved from the request.
   
   </p><p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="http://livedocs.adobe.com/flex/2/langref/flash/net/URLLoaderDataFormat.html" target="mm_external">flash.net.URLLoaderDataFormat</a>
</div>
</div>
<a name="responseHeaders"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">responseHeaders</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>responseHeaders:Array</code>&nbsp;&nbsp;[read-only]<p>
   Will contain the response headers as soon as the complete event has been dispatched.
   This array will contain instances of URLRequestHeader.
   
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get responseHeaders():Array</code>
<br>
<p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="http://livedocs.adobe.com/flex/2/langref/flash/net/URLRequestHeader.html" target="mm_external">flash.net.URLRequestHeader</a>
</div>
</div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="SocketURLLoader()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">SocketURLLoader</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function SocketURLLoader(request:Object = null)</code><p>
   The reqeust is given to the load method if given. Defaults the dataFormat
   property to URLLoaderDataFormat.TEXT.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">request</span>:Object</code> (default = <code>null</code>)<code></code></td>
</tr>
</table>
<p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="../as3httpclient/SocketURLLoader.html#load()" target="">load()</a>
</div>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="close()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">close</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function close(dispatchEvent_bool:Boolean = false):void</code><p>
   If the socket is connected it will be closed.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">dispatchEvent_bool</span>:Boolean</code> (default = <code>false</code>)<code></code> &mdash; if set to true a close event is dispatched.
   </td>
</tr>
</table>
</div>
<a name="load()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">load</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function load(request:Object):void</code><p>
   If the given request is of type URLRequest, the reqeust is converted to an instance of 
   SocketHTTPRequest.<br />
   <br />
   If the socket is still open it will close the socket.<br />
   <br />
   If no port could be extraced from the url, port 80 is used.<br />
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">request</span>:Object</code> &mdash; An instance of URLRequest, SocketHTTPRequest or SocketHTTPFileRequest.
   
   </td>
</tr>
</table>
<br>
<span class="label">Throws</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code></code> &mdash; if the request is not of type URLRequest, SocketHTTPRequest or SocketHTTPFileRequest
   </td>
</tr>
</table>
</div>
<div class="detailSectionHeader">Event detail</div>
<a name="event:close"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">close</td><td class="detailHeaderType">event&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.Event</code></a>
<br>
<p></p><p>
  Dispatched when the socket is closed.
  </p></div>
<a name="event:complete"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">complete</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.Event</code></a>
<br>
<p></p><p>
  Dispatched when the data has completed loading
  </p></div>
<a name="event:httpStatus"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">httpStatus</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.HTTPStatusEvent</code></a>
<br>
<p></p><p>
  Dispatched if the header is received from the server
  </p></div>
<a name="event:ioError"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">ioError</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.IOErrorEvent</code></a>
<br>
<p></p><p>
  Dispatched when a socket throws an ioError
  </p></div>
<a name="event:open"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">open</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.Event</code></a>
<br>
<p></p><p>
  Dispatched when the socket is connected.
  </p></div>
<a name="event:progress"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">progress</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.ProgressEvent</code></a>
<br>
<p></p><p>
  Note that the progress event gives strange results for chunked data
  If the data received from the server is send chunked it will send progress 
  events for each separate chunk. That meanse that bytesLoaded and bytesTotal
  will count for the chunk that is currently being processed.
  </p></div>
<a name="event:securityError"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">securityError</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.SecurityErrorEvent</code></a>
<br>
<p></p><p>
  Dispatched when the socket throws a security error
  </p></div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
